﻿<%@ WebHandler Language="C#" Class="ExecuteHandler"%>

using System.Web;

public class ExecuteHandler : IHttpHandler {

    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        //1. 传值方式为GET时：context.Request.Params.Get("id")
        //2. 传值方式为POST时：Request.Params["id"].toString()
        //context.Response.ContentType = "application/json";      
        //string name = context.Request.Form["user_name"]; //POST提交的数据
        string sql = context.Request.Params["sql"].ToString();
        DB excute = new DB();
        if (excute.Execte(sql))
        {
            context.Response.Write("1");
        }
        else { context.Response.Write("0"); }
        context.Response.End();
    }

    //[WebMethod]
    // public static string GetJson(string RID)
    // {
    //     return "{'ID':'" + RID + "'}";
    // }
    public bool IsReusable {
        get {
            return false;
        }
    }

}